import 'package:path/path.dart' as path;

extension StringImageCheck on String {
  // 判断是否是图片路径
  bool isImagePath() {
    final imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp'];
    return imageExtensions.any((ext) => toLowerCase().endsWith(ext));
  }

  bool isVideoPath() {
    final videoExtensions = ['.mp4', '.mov', '.avi', '.mkv', '.flv', '.wmv'];
    return videoExtensions.any((ext) => toLowerCase().endsWith(ext));
  }

  String? extention() {
    return path.extension(this);
  }
}
